/**
 * \class CHashedFileTransfer
 * \brief This is a file transfer class in a DHT-based way.
 * \version 0.3.2
 *
 * \author Woo-Hyun Kim (woorung@nhncorp.com, woorung@gmail.com)
 * \author http://blog.naver.com/wisereign .
 *
 * \date 2008/6/18
 */
#ifndef CHashedFileTransferH
#define CHashedFileTransferH
//-----------------------------------------------------------------
#include <iostream>
#include <vector>
#include <map>

#include "common_task.h"

#include "service/CFileProxy.h"

#include "CChord.h"
#include "CNodeIPKey.h"

using namespace std;
//-----------------------------------------------------------------
class CHashedFileTransfer {
private :
	string discovery_host;
	int discovery_port;

protected :
	int lookup(char *key, CServiceInfo &found_file_service);

public :
	CHashedFileTransfer(char *host, int port); 
	virtual ~CHashedFileTransfer();

	int put(char *file);
	int put(char *file, char *repository_path);
	int put(char *host, int port, char *file);
	int put(char *host, int port, char *file, char *repository_path);
	
	int get(char *file);
	int get(char *file, char *repository_path);
	int get(char *host, int port, char *file);
	int get(char *host, int port, char *file, char *repository_path);

	// for getting trivial file
	int tget(char *file, char *tkey);
	int tget(char *file, char *tkey, char *repository_path);
};
//-----------------------------------------------------------------
#endif
